package com.cool.feiyan.ui.notifications

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.fragment.app.Fragment
import androidx.lifecycle.Observer
import androidx.lifecycle.ViewModelProviders
import com.cool.feiyan.R

class NotificationsFragment : Fragment() {

    private lateinit var notificationsViewModel: NotificationsViewModel

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        notificationsViewModel =
            ViewModelProviders.of(this).get(NotificationsViewModel::class.java)

        val root = inflater.inflate(R.layout.fragment_about, container, false)

        val textViewTitle: TextView = root.findViewById(R.id.text_title)

        notificationsViewModel.title.observe(this, Observer {
            textViewTitle.text = it
        })

        val textViewUri : TextView = root.findViewById(R.id.text_view_uri)
        notificationsViewModel.uri.observe(this, Observer {
            textViewUri.text = it
        })

        val textViewTip : TextView = root.findViewById(R.id.text_view_tip)
        notificationsViewModel.tip.observe(this, Observer {
            textViewTip.text = it
        })

        val textViewVersion : TextView = root.findViewById(R.id.text_view_version)
        notificationsViewModel.version.observe(this, Observer {
            textViewVersion.text = it
        })
        return root
    }
}